import {computed} from 'vue'
import {toF9} from "@/utils";

export function useTable() {
  const infos = computed(() => {
    return (item) => {
      return [
        {name: '债券简称', value: item.bondShortName},
        {name: '债券代码', value: item.securitiesCode},
        {name: '债券类型', value: item.bondTypeName},
        {name: '债券期限', value: item.bondPeriod},
        {
          name: '发行规模', value: <div>
            <span class="mr-10px">
              {item.issuingScale ? item.issuingScale + '亿' : '-'}
            </span></div>
        },
        {name: '发行起始日', value: item.issuingDate},
        {
          name: '票面利率', value: <div>
            <span class="mr-10px">
              {item.couponRateDisplay ? item.couponRateDisplay + '%' : '-'}
            </span></div>
        },
        {name: '计息方式', value: item.calculateInterestMethod},
        {name: '起息日', value: item.valueDate},
        {name: '到期日', value: item.maturityDate},
        {
          name: '债券评级', showTitle: '评级日期/评级等级/评级机构', value: <div>
            <span
            >{item.facilityRatingDate || '-'}/
            </span>
            <span>{item.facilityRating || '-'}/</span>
            <span
            >{item.facilityRatingAgency || '-'}
            </span>
          </div>, span: 2
        },
        {
          name: '发行人', value: <div>
            <span
              onClick={() => toF9(item.companyId)}
              class="common-link">{item.companyName}
            </span>
            <span class="label-tag">{item.province}/{item.city || '-'}</span>
            <span
              class="label-tag">{item.industryCategory}/{ item.debtorRating || '-'}
            </span>
          </div>, span: 2
        },
        {
          name: '绿色评估机构', value: <div>
            {item.greenEvaluationAgency ? <span
              onClick={() => toF9(item.greenEvaluationAgency.companyId)}
              class="common-link">{item.greenEvaluationAgency.evaluationAgency}
            </span> : <span>-</span>}
          </div>, span: 2
        },
      ];
    };
  });
  return {
    infos
  }
}
